package com.bree.erp.entity;

import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

@NamedQuery(name = Group.QUERY_FIND_GROUPS_BY_TYPE, 
			query = "SELECT g FROM Group g WHERE g.groupId = :groupId")
@Entity
@Table(name="GROUPTABLE")
public class Group {
	
	public static final String QUERY_FIND_GROUPS_BY_TYPE = "findGroupsByType";

	@Id 
	@GeneratedValue(strategy=GenerationType.SEQUENCE)
	private long id;
	
	@Enumerated(EnumType.STRING)
	private GroupType groupId;
	
	@ManyToOne
	@JoinColumn(name="EMAIL")
	private User user;

	/**
	 * @return the id
	 */
	public long getId() {
		return id;
	}

	/**
	 * @param id the id to set
	 */
	public void setId(long id) {
		this.id = id;
	}

	/**
	 * @return the groupId
	 */
	public GroupType getGroupId() {
		return groupId;
	}

	/**
	 * @param groupId the groupId to set
	 */
	public void setGroupId(GroupType groupId) {
		this.groupId = groupId;
	}

	/**
	 * @return the user
	 */
	public User getUser() {
		return user;
	}

	/**
	 * @param user the user to set
	 */
	public void setUser(User user) {
		this.user = user;
	}
	
	
}
